package cn.itcast.nems.listener.studentrecord;

import cn.itcast.nems.listener.NemsMessageListener;
import cn.itcast.nems.order.dto.PaymentFlowDTO;
import cn.itcast.nems.studentrecord.service.studentrecord.StudentRecordMessageService;
import com.alibaba.fastjson.JSON;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 添加学籍支付流水消息监听处理逻辑
 * </p>
 *
 * @author zhouwei
 * @since 2023/12/7 2:08 PM
 **/
@Component
@RequiredArgsConstructor
public class StudentRecordFlowMessageListener implements NemsMessageListener {
    private final static String TagName  =  "TAG_STUDENT_RECORD_ORDER_FLOW" ;
    private final StudentRecordMessageService studentRecordMessageService ;

    @Override
    public String getTagName() {
        return TagName;
    }

    @Override
    public void processMessage(String body) {
        PaymentFlowDTO flow = JSON.parseObject(body, PaymentFlowDTO.class);
        studentRecordMessageService.receiveOrderFlowMessage(flow);
    }
}
